<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台-用户管理</title>
    <link rel="icon" type="image/png" sizes="16x16" href="../../static/icons/favicon.svg">
    <script src="../../static/jQuery.js"></script>
    <link rel="stylesheet" href="../../static/page.css">
    <link rel="stylesheet" href="../../static/admin/css/nav.css">
    <link rel="stylesheet" href="../../static/admin/css/item.css">
    <link rel="stylesheet" href="../../static/admin/css/user.css">


    <script src="../../static/admin/js/nav.js"></script>
    <script src="../../static/admin/js/user.js"></script>

</head>
<body>
<div class="tz_content">
    <!--左侧导航栏 start-->
    <div class="t_left">
        <div class="l_logo"></div>
        <div class="l_nav">
            <ul>
                <li>
                    <a href="{{ url_for('admin.index') }}">
                        <img src="../../static/icons/home(white).svg"
                             style="width: 20px;height:20px;vertical-align: text-bottom;">
                        <span>首页</span>
                    </a>
                </li>
                <li>
                    <a href="{{ url_for('admin.item_view') }}">
                        <img src="../../static/icons/item_list.svg"
                             style="width: 20px;height:20px;vertical-align: text-bottom;">
                        <span>商品列表</span>
                    </a>
                </li>

                <li>
                    <a href="{{ url_for('admin.order') }}">
                        <img src="../../static/icons/order_list.svg"
                             style="width: 20px;height:20px;vertical-align: text-bottom;">
                        <span>订单列表</span>
                    </a>
                </li>
                <li class="active">
                    <a href="{{ url_for('admin.user') }}">
                        <img src="../../static/icons/user_list.svg"
                             style="width: 20px;height:20px;vertical-align: text-bottom;">
                        <span>用户列表</span>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <!--左侧导航栏 end-->

    <!--头部导航栏 start-->
    <div class="t_header">
        <!--h_nav start-->
        <div class="h_nav">
            <h2>网上书城后台管理</h2>
        </div>
        <!--end h_nav-->

        <!--h_info start-->
        <div class="h_info">
            <div class="h_user">当前用户：
                {% if admin %}
                <a href="javascript:;" class="logout h_out" style="line-height: 30px;text-align: center;color: #fff;">
                    {{ admin.name }}
                </a>
                {% endif %}
            </div>
        </div>
        <!--end h_info-->

    </div>
    <!--头部导航栏 end -->

    <!--内容区域 end-->
    <div class="items">
        <div class="search">
            <a href="javascript:;"><span class="clear-btn">清空搜索</span></a>
            <!--            <a href="javascript:;"><span class="add-btn">添加商品</span></a>-->
            {% with messages = get_flashed_messages() %}
            {% if messages %}
            {% for message in messages %}
            <span style="color: red">提示：{{ message }}</span>
            {% endfor %}
            {% endif %}
            {% endwith %}
            <input type="text" class="search-ipt" placeholder="输入用户名">
            <img class="search-icon" style="width: 20px;height: 20px;" src="../../static/icons/search.svg">
        </div>

        <ul class="list">
            {% for user in users %}
            <li data-user_id="{{ user.id }}">
                <!--                <span class="id">用户id：{{user.id}}</span>-->
                <span class="name">用户名：{{user.name}}</span>
                <span class="pwd">密码：{{user.password}}</span>
                {% if user.admin == 0 %}
                <span class="admin">身份：用户</span>
                {% else %}
                <span class="admin">身份：管理员</span>
                {% endif %}
                <a href="javascript:;" class="edit-btn">修改</a>
            </li>
            {% endfor %}
        </ul>
        <div class="pagination">
            <!-- 左侧箭头 -->
            {% if page.has_prev %}
            <a href="{{ url_for('admin.user', page=page.prev_num) }}" class="pagination-arrow" id="prev-page"
               aria-label="Previous Page"><</a>
            {% else %}
            <a href="javascript:;" class="pagination-arrow" aria-label="Previous Page"><</a>
            {% endif %}
            {% for p in page.iter_pages(left_edge=1, right_edge=1, left_current=1, right_current=2) %}
            {% if p %}
            {% if p == page.page %}
            <a href="{{ url_for('admin.user', page=p) }}" class="current-page">{{ p }}</a>
            {% else %}
            <a href="{{ url_for('admin.user', page=p) }}">{{ p }}</a>
            {% endif %}
            {% else %}
            <span class="ellipsis">...</span>
            {% endif %}
            {% endfor %}
            <!-- 右侧箭头 -->
            {% if page.has_next %}
            <a href="{{ url_for('admin.user', page=page_book.next_num) }}" class="pagination-arrow"
               id="next-page" aria-label="Next Page">></a>
            {% else %}
            <a href="javascript:;" class="pagination-arrow"
               aria-label="Next Page">></a>
            {% endif %}
        </div>
    </div>
    <!--内容区域 end-->

</div>

<!--修改用户对话框-->
<div class="mask2" style="display: none">
    <form action="/admin/upd_user" method="post" class="det-user">
        <h3 style="margin-bottom: 10px">修改用户</h3>
        <input type="text" class="upd_id" name="id" style="display: none">
        <input type="text" name="item_name" placeholder="修改用户名"><br>
        <input type="text" name="item_author" placeholder="修改用户密码"><br>
        <label for="radio1" style="display: inline-block;width: 40px">用户:</label>
        <input style="width: 10px;height: 10px;" type="radio" id="radio1" name="radios" value="user"><br>
        <label for="radio2" style="display: inline-block;width: 40px">管理员:</label>
        <input style="width: 10px;height: 10px;" type="radio" id="radio2" name="radios" value="admin"><br>
        <a href="javascript:;" class="det-y"><input type="submit" value="确认"></a>
        <a href="javascript:;" class="det-n"><input type="button" value="取消"></a>
    </form>
</div>
<!--修改用户对话框-->
</body>
</html>